//模拟apply

//apply原理与call很相似；不多赘述

Function.prototype.myapply = funciton(context,arr){
    var context = Object(context) || window
    context.fn = this
    var result;
    if(!arr){
        result = context.fn();
    }else{
        var args = []
        for(var i=0;i<arr.length;i++){
            args.push("arr["+i+"]")
        }
        result = eval("context.fn("+args+")")
    }
    delete context.fn
    return result;
}